<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //若执行器函数中是异步任务, 则先指定回调, 然后再改变状态  更为常见
        //若执行器函数中是同步任务, 则先改变状态, 然后再指定回调
        // let p = new Promise((resolve, reject) => {
        //     setTimeout(() => {
        //         resolve('ok');
        //     }, 1000);
        // });

        // p.then(value => {
        //     console.log(value);
        // }, reason => {
        //     console.error(reason);
        // });

        new Promise((resolve, reject) => {
            console.log(111);
            reject();
        }).then(value => {
            console.log(222);
        }).then(value=> {
            console.log(value);
        }).then(value => {
            console.log(value)
        }, reason => {
            console.error(reason);
        });
    </script>
</body>
</html>